package com.arpa.wms.domain.entity;

import com.arpa.wms.domain.vo.PutawayItemWithRegisterVO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 上架
 * </p>
 *
 * @author LEO
 * @since 2020-08-04
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wms_putaway")
@ApiModel(value="Putaway对象", description="上架")
public class Putaway extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "上架单号")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "仓库")
    @TableField("warehouse_code")
    private String warehouseCode;

    @ApiModelProperty(value = "入驻商")
    @TableField("shipment_code")
    private String shipmentCode;

    @ApiModelProperty(value = "入驻商")
    @TableField("shipment_name")
    private String shipmentName;

    @ApiModelProperty(value = "供应商")
    @TableField("supplier_code")
    private String supplierCode;

    @ApiModelProperty(value = "所属机构Code")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "收货单号")
    @TableField("receive_code")
    private String receiveCode;

    @ApiModelProperty(value = "下发状态:0未下发，1已下发；")
    @TableField("is_issue")
    private Integer issue;


    @ApiModelProperty(value = "总数量")
    @TableField("total_quantity")
    private BigDecimal totalQuantity;

    @ApiModelProperty(value = "上架数量")
    @TableField("putaway_quantity")
    private BigDecimal putawayQuantity;

    @ApiModelProperty(value = "状态;0：待上架:1：上架中；2：部分上架；3：上架完成；")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 255, message = "备注长度不能大于255", groups = {Save.class})
    private String remarks;

    @ApiModelProperty(value = "上架单明细")
    @TableField(exist = false)
    private List<PutawayItem> putawayItemList = new ArrayList<>();

    @ApiModelProperty(value = "操作员")
    @TableField("operator_name")
    private String operatorName;


    @ApiModelProperty(value = "上架确认单明细")
    @TableField(exist = false)
    @Valid
    private List<PutawayItemWithRegisterVO> putawayRegisterWithItemVOS;

    @ApiModelProperty(value = "是否oms下发的；0：否；1：是；用于后期判断反填oms数据")
    @TableField("is_oms_order")
    private Integer isOmsOrder;

    public interface Save{}

}
